FROM tomcat_vnc:2.0
MAINTAINER wang yufu <wangyufu@ipieuvre.com>

ADD startup.sh ./
ADD sources.list /etc/apt/sources.list

RUN apt-get update \
    && apt-get install -y zip libcairo2-dev libpng12-dev libossp-uuid-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev libvorbis-dev \
    && apt-get autoclean \
    && apt-get autoremove \
    && rm -rf /var/lib/apt/lists/*
RUN apt-get install -y wget

RUN curl -L 'http://sourceforge.net/projects/guacamole/files/current/source/guacamole-server-0.9.9.tar.gz' | tar -xz && cd guacamole-server-0.9.9/ \
    && ./configure --with-init-dir=/etc/init.d && make && make install && ldconfig 
RUN wget 'http://sourceforge.net/projects/guacamole/files/current/binary/guacamole-0.9.9.war' && mv guacamole-0.9.9.war /opt/tomcat7/webapps/guacamole.war 
RUN mkdir /etc/guacamole && mkdir /opt/tomcat7/.guacamole && ln -s /etc/guacamole/guacamole.properties /opt/tomcat7/.guacamole/ 
RUN echo "GUACAMOLE_HOME=/etc/guacamole/" >> /etc/profile 
ADD user-mapping.xml /etc/guacamole/
ADD guacamole.properties /etc/guacamole/
RUN useradd -d /opt/tomcat7/ tomcat7
RUN chown -R tomcat7.tomcat7  /opt/tomcat7/
EXPOSE 8080 22 5900
ENTRYPOINT ["./startup.sh"] 
